<link rel="stylesheet" href="{$static_path}kindeditor/default/default.css" />
<script charset="utf-8" src="{$static_path}kindeditor/kindeditor-min.js"></script>
<script charset="utf-8" src="{$static_path}kindeditor/zh_CN.js"></script>
<script type="text/javascript">

    var editor_{$addons_data.name};
    KindEditor.ready(function(K) {
            editor_{$addons_data.name} = K.create('textarea[name="{$addons_data.name}"]', {
                    allowFileManager : false,
                    themesPath: K.basePath,
                    width: '100%',
                    height: '{$addons_config.editor_height}',
                    resizeType: {eq name="addons_config.editor_resize_type" value="1"}1 {else /} 0 {/eq},
                    pasteType : 2,
                    urlType : 'absolute',
                    fileManagerJson : '{:url('fileManagerJson')}',
                    uploadJson : '{:addons_url("editor://Upload/pictureUpload")}',
                    items : [
                    'source', 'undo', 'redo', 'cut', 'copy','paste', 'plainpaste', 'wordpaste','selectall',
                    'justifyleft','justifycenter','justifyright','justifyfull','insertorderedlist','indent',
                    'outdent','subscript','superscript','fontname','fontsize','forecolor','hilitecolor','bold',
                    'italic','underline','strikethrough','removeformat','image','table',
                    'link','unlink','fullscreen'
                    ],
                    extraFileUploadParams: { session_id : '{:session_id()}'}
            });
    });

    $(function(){
        //ajax提交之前同步
        $('button[type="submit"],#submit,.ajax-post,#autoSave').click(function(){
                editor_{$addons_data.name}.sync();
        });
    });
</script>
